<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:a4j="http://richfaces.org/a4j">
    <body>
        <ui:composition template="./main-template.xhtml">
            <ui:param name="titulo" value="Administración del Catalogo" />
            <ui:define name="body">
                <rich:panel id="panelCompra">
                    <f:facet name="header" >
                        Pagar
                    </f:facet>
                    <rich:messages passedLabel="Data is allowed to be stored." layout="list">
                        <f:facet name="header">
                            <h:outputText value="Entered Data Status:"></h:outputText>
                        </f:facet>
                        <f:facet name="passedMarker">
                            <h:graphicImage value="/img/error.png" />
                        </f:facet>
                        <f:facet name="errorMarker">
                            <h:graphicImage value="/img/error.png" />
                        </f:facet>
                    </rich:messages>
                    <rich:panel>
                        <f:facet name="header" >
                            Descripcion de la Venta
                        </f:facet>
                        <h:panelGrid columns="2">
                            <h:outputLabel value="Referencia" styleClass="label"/>
                            <h:outputText value="#{PagarBean.compra.referencia}"/>
                            <h:outputLabel value="Valor" styleClass="label"/>
                            <h:outputText value="#{PagarBean.compra.valor}"/>
                            <h:outputLabel value="Descripcion" styleClass="label"/>
                            <h:inputTextarea value="#{PagarBean.compra.descripcion}" rows="5"/>
                        </h:panelGrid>
                        <h:panelGrid columns="2">
                            <a4j:form>
                                <a4j:commandButton value="Realizar Compra" action="#{PagarBean.realizarCompra}"
                                                   reRender="panelCompra" rendered="#{!PagarBean.compraRealizada}"/>
                                <a4j:commandButton value="Volver al Catalogo" action="#{PagarBean.volverCatalogo}"/>
                            </a4j:form>
                        </h:panelGrid>
                    </rich:panel>
                </rich:panel>
            </ui:define>
        </ui:composition>
    </body>
</html>

